#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int is_upper_triangular_matric(int (*str)[10], int n)
{
	int i = 0;
	for (i = 1;i < n;i++)
	{
		int j = 0;
		for (j = 0;j < i;j++)
			if (str[i][j] != '\0')
				return 0;
	}
		return 1;
}

int main()
{
	int n = 0;
	scanf("%d", &n);
	int i = 0;
	int j = 0;
	int arr[10][10] = { 0 };
	for (i = 0;i < n;i++)
		for (j = 0;j < n;j++)
			scanf("%d", &arr[i][j]);
	int flag = is_upper_triangular_matric(arr, n);
	if (flag)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}